package cn.demarcia.coco.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;

import com.ogaclejapan.smarttablayout.SmartTabLayout;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.demarcia.coco.R;
import cn.demarcia.coco.ui.adapter.JokePagerAdapter;

/**
 * Created by lzy
 * on 2016/8/9.
 */
public class JokeActivity extends BaseActivity {
    @Bind(R.id.viewPager)
    ViewPager viewPager;
    @Bind(R.id.indicator)
    SmartTabLayout indicator;
    @Bind(R.id.toolbar)
    Toolbar toolbar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_joke);
        ButterKnife.bind(this);
        toolbar.setTitle(R.string.joke);
        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
        //noinspection deprecation
        toolbar.setTitleTextColor(getResources().getColor(R.color.white));
        setSupportActionBar(toolbar);

        FragmentPagerAdapter dynamicAdapter = new JokePagerAdapter(this, getSupportFragmentManager());
        viewPager.setAdapter(dynamicAdapter);
        indicator.setViewPager(viewPager);
    }
}
